<template>
    <div>
        <el-card class="box-card">
            <div slot="header" class="clearfix">
                <span>修改管理员</span>
            </div>


            <el-form ref="form" :model="form" label-width="80px">
                <el-form-item label="名称">
                    <el-input v-model="form.name"></el-input>
                </el-form-item>
                <el-form-item label="手机号">
                    <el-input v-model="form.mobile"></el-input>
                </el-form-item>
                <el-form-item label="密码">
                    <el-input v-model="form.password"></el-input>
                </el-form-item>
            </el-form>
            <el-button type="primary" @click="onSubmit">提交</el-button>
        </el-card>

    </div>
</template>

<script>
export default {
    route: {path: "admin/:id/edit",meta:{title:"编辑管理员"}},
    data() {
        return {
            id: this.$route.params.id,
            form: {}
        }
    },
    async created() {
        this.form = await this.axios.get(`admin/admin/${this.id}`)
    },
    methods: {
        async onSubmit() {
            await this.axios.put(`admin/admin/${this.id}`, this.form)
        }
    }
}
</script>

<style scoped>

</style>
